package com.yang.dao;

import com.yang.entity.EmailTemplate;
import org.apache.ibatis.annotations.*;

/**
 * @author yangdacheng
 * @title: EmailTemplateDao 邮件模板
 * @projectName note_api
 * @description: TODO
 * @date 2022/3/7 8:10 下午
 */
@Mapper
public interface EmailTemplateDao {

    /**
     * 根据模板编号获取模板
     * @param tID
     * @return
     */
    @Select("SELECT * FROM emailTemplate WHERE templateID = #{tID}")
    @Results(value = {
            @Result(column = "templateID",property = "templateID",id = true),
            @Result(column = "codeTemplate",property = "codeTemplate"),
            @Result(column = "testTemplate",property = "testTemplate"),
    },id = "templateMapper")
    EmailTemplate getTemplateByID(String tID);

    /**
     * 根据模板编号修改模板信息
     * @param emailTemplate
     * @return
     */
    @Update("UPDATE emailTemplate SET codeTemplate=#{codeTemplate},testTemplate=#{testTemplate} " +
            "WHERE templateID=#{templateID}")
    Boolean updTemplateByID(EmailTemplate emailTemplate);
}
